package com.neutech.maplestory.entity;

import com.neutech.maplestory.client.MapleStoryClient;
import com.neutech.maplestory.util.ImageUtil;

import java.awt.*;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

public class ItemPackage extends AbstractMapleStoryObject {
    public List<Item> packItemList = new CopyOnWriteArrayList<>();
    public Image image;

    public ItemPackage(MapleStoryClient msc) {
        this();
        this.msc = msc;
        this.image = ImageUtil.getImage("hero_item_package");
        this.live = false;
        this.width = image.getWidth(null);
        this.height = image.getHeight(null);

    }

    public ItemPackage() {
        this.x = 1300;
        this.y = 350;
    }

    @Override
    public void draw(Graphics g) {
        if (this.live) {
            g.drawImage(image, x, y, null);
            for (int i = 0; i < packItemList.size(); i++) {
                Item item = packItemList.get(i);
                int itemY = y + 55;
                int itemX = x + (i * 35) + 13;
                int strX = x + (i * 35) + 35;
                int strY = y + 85;
                int n = 4;
                if (i > 3) {
                    itemX = itemX - (n * 35);
                    itemY = itemY + 35;
                    strY = strY + 35;
                    strX = strX - (n * 35);
                }
                g.drawImage(item.image, itemX, itemY, null);
                g.drawString(item.quantity + "", strX, strY);
            }
        }
    }
}




















